﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using digitwhu.Models;
using digitwhu.Models.Repositorys;
using digitwhu.Helper;
using System.Runtime.Serialization.Json;
using System.Runtime.Serialization;

namespace digitwhu.Logic.ClassLibrary
{

    [DataContract]
    public class ROriginalMicroBlog
    {
        //原创微博可序列化类，来自于表OriginalMicroBlog
        [DataMember]
        public int userId;
        [DataMember]
        public int originalBlogId;
        [DataMember]
        public string blogDateTime;
        [DataMember]
        public string blogContent;
        [DataMember]
        public int? replyType;      //逻辑不能为空，由于数据库中数据有空，为方便，暂时设定可以为空
        [DataMember]
        public int? commentCount;//某条评论的数量(应该也不可以为空)
        [DataMember]
        public int? tranCount;//某条原创微博被转发的数量
        //说明：转发微博的数量是由只想原创微博的转发微博数量来确定。
        //在系统数据库中，转发微博被转发，会导致原创微博被转发的数量增加
    }
    [DataContract]
    public class RTranMicroBlog
    {
        //转发微博可序列化类，来自于表TranMicroBlog
        [DataMember]
        public int userId;
        [DataMember]
        public int tranMicroBlogId;
        [DataMember]
        public int originalBlogId;
        [DataMember]
        public string tranDateTime;
        [DataMember]
        public string tranReason;
        [DataMember]
        public int? replyType; //逻辑不能为空，由于数据库中数据有空，为方便，暂时设定可以为空
        [DataMember]
        public int? commentCount;//转发微博被评论的数量
        //说明：系统数据库设计暂时不能计算出转发微博被转发的数量
    }
    [DataContract]
    public class RBlog
    {
        //微博列表类。包含字段原创微博作者，原创微博，转发微博作者，转发微博
        //如果是原创微博，字段tranBlog和tranUser为空
        [DataMember]
        public RUserInfo originalUser;
        [DataMember]
        public ROriginalMicroBlog originalBlog;
        [DataMember]
        public RUserInfo tranUser;
        [DataMember]
        public RTranMicroBlog tranBlog;
        public RBlog() { }
    }
    [DataContract]
    public class RCommentUnit
    {
        //评论类。来自表OriginBlogComent或者TranBlogComment
        //不包含该评论的原始微博ID字段(originalBlogId)或者转发微博字段(tranMicroBlogId)
        [DataMember]
        public int commentId;
        [DataMember]
        public int blogId;
        [DataMember]
        public int userId;
        [DataMember]
        public string dateTime;
        [DataMember]
        public string comment;
    }
    [DataContract]
    public class RComment
    {
        //一条评论类。包含字段用户信息和评论内容
        //对原创微博和转发微博的评论都做同样的处理
        [DataMember]
        public RUserInfo userInfo;
        [DataMember]
        public RCommentUnit  comment;
        public RComment() { }
    }
   [DataContract]
    public class RCommentList
    {
       //某条微博的评论列表类。包括字段微博内容和评论列表
        [DataMember]
        public RBlog   blog;
        [DataMember]
        public List<RComment > commenList;
        public RCommentList()
        { 
        }
    }
  [DataContract]
   public class RPrivateMsg
   {
      //私信类。来自表PrivateMsg
      [DataMember]
       public RUserInfo msgFromUser;
      [DataMember]
       public string msgDateTime;
      [DataMember]
       public string msgContent;
      [DataMember]
       public int? privateMsgId;
   }
}